<?php
/*******************************************************************************
date must be convered to yyyy-mm-dd format
time must be converted to hh:mm format
*******************************************************************************/

	require_once "Date.php";
	require_once "events.php";
	
	$client = $_SESSION['client'];
	$title = $_POST['edit_eventname'];
	$desc= $_POST['edit_eventdesc'];
	$where = $_POST['edit_eventloc'];
	$eventId = $_POST['eid'];
	$startDate = slashedDateToDb($_POST['edit_eventsdate']);
	$startTime = setMilitaryTime($_POST['edit_eventstime']);
	$endDate = slashedDateToDb($_POST['edit_eventedate']);
	$endTime = setMilitaryTime($_POST['edit_eventetime']);
	$tzOffset = '-07';
	$allday = $_POST['edit_allDay'];
	$calendar = $_POST['addeventcal'];


	//note this for use in changing events
	$exploded=explode('/',$eventId);
	$newId=$exploded[8];
	

	//echo "$eventId, $title, $desc, $where, $startDate, $startTime, $endDate, $endTime, $tzOffset, $allDay";
	if (!$allday){
		updateEvent ($client, $newId, $title, $desc, $where, $startDate, $startTime, $endDate, $endTime, $tzOffset);
	}else{
		updateEvent ($client, $newId, $title, $desc, $where, $startDate, '', $endDate, '', $tzOffset);
	}
	
	header("location:viewMonth.php");
	
?>
